package com.luli.service;

import org.elasticsearch.rest.RestStatus;

import java.io.File;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.util.List;
import java.util.Map;

/**
 * 陆离
 * 2022/5/3 20:21:14
 */
public interface IElasticSearchService {

    /**
     * 初始化页面使用查询所有数据
     * @return
     */
    public List<Map<String, Object>> selAllData() throws IOException;

    /**
     * 新建索引
     * @param keyword
     * @return
     * @throws IOException
     */
    public Boolean searchKeyword(String keyword) throws IOException;

    /**
     * 根据关键字，分页查询
     * @param keyword
     * @param pageNo
     * @param pageSize
     * @return
     * @throws IOException
     */
    public List<Map<String, Object>> searchPage(String keyword, int pageNo, int pageSize) throws IOException;

    /**
     * 高亮查询 根据关键字，分页查询
     * @param keyword
     * @param pageNo
     * @param pageSize
     * @return
     * @throws IOException
     */
    public List<Map<String, Object>> searchHighlight(String keyword, int pageNo, int pageSize) throws IOException;

    /**
     * 根据id删除
     * @param id
     * @return
     * @throws IOException
     */
    public RestStatus deleteGood(String id) throws IOException;

    /**
     * 上传文件夹新建模板
     * @param fileName
     * @return
     */
    public Boolean uploadingText(File fileName);

    /**
     * 上传文件新建模板
     * @param file
     * @return
     */
    public Boolean fileUploading(File file) throws IOException;
}
